package com.tangsm.spring.boot.xml.filter;

import com.tangsm.spring.boot.xml.wrapper.ParameterNameRequestWrapper;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * GET请求参数过滤器，下划线转成驼峰
 *
 * @author tangyb
 */
public class ParameterNameConverterFilter extends OncePerRequestFilter {
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
            throws ServletException, IOException {
        ParameterNameRequestWrapper requestWrapper = new ParameterNameRequestWrapper(request);
        filterChain.doFilter(requestWrapper, response);
    }
}
